home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2007 September / PCWSEP07.iso / Software / Linux / Linux Mint 3.0 Light / LinuxMint-3.0-Light.iso / casper / filesystem.squashfs / bin / partman-commit < prev    next >
Encoding:
Text File  |  2007-04-03  |  2.4 KB  |  111 lines

  1. #!/bin/sh
  2. set -e
  3.  
  4. . /lib/partman/definitions.sh
  5.  
  6. cleanup () {
  7.     if [ -f /var/run/parted_server.pid ]; then
  8.         stop_parted_server
  9.     fi
  10. }
  11. trap cleanup EXIT
  12.  
  13. db_capb backup
  14.  
  15. # Measure the width of partman/text/number here to make things faster.
  16. # number_width is used only in visual.d/number
  17. db_metaget partman/text/number description
  18. RET=$(printf "$RET" '')
  19. RET=$(stralign 50 "$RET" | sed 's/[^ ]//g')
  20. number_width=$((2 + 50 - ${#RET}))
  21. export number_width
  22.  
  23.  
  24. # Here is maybe not a good place to set deci (TODO)
  25. #db_metaget partman/text/deci description
  26. #deci="$RET"
  27. #export deci
  28.  
  29. # The comma has special meaning for debconf.  Lets force dot untill we
  30. # discover where the comma has to be escaped..
  31. deci='.'
  32.  
  33. # If porting this to Debian, be careful! Debian's partman starts automatic
  34. # partitioning from an init.d script (rather than auto.d as in Ubuntu),
  35. # which will probably have undesirable consequences unless care is taken to
  36. # suppress it.
  37. initcount=`ls /lib/partman/init.d/* | wc -l`
  38. db_progress START 0 $initcount partman/progress/init/title
  39. for s in /lib/partman/init.d/*; do
  40.     if [ -x $s ]; then
  41.         base=$(basename $s | sed 's/[0-9]*//')
  42.         # Not every init script has, or needs, its own progress
  43.         # template. Add them to slow init scripts only.
  44.         if ! db_progress INFO partman/progress/init/$base; then
  45.             db_progress INFO partman/progress/init/fallback
  46.         fi
  47.         if ! $s; then
  48.             db_progress STOP
  49.             exit 10
  50.         fi
  51.     fi
  52.     db_progress STEP 1
  53. done
  54. db_progress STOP
  55.  
  56. # Hack to handle information fed into partman by an external agent (i.e.
  57. # Ubiquity).
  58. if [ "$PARTMAN_UPDATE_BEFORE_COMMIT" ]; then
  59.     for dev in /var/lib/partman/devices/*; do
  60.         [ -d "$dev" ] || continue
  61.         cd $dev
  62.         partitions=
  63.         open_dialog PARTITIONS
  64.         while { read_line partinfo; [ "$partinfo" ]; }; do
  65.             if [ "$partitions" ]; then
  66.                 partitions="$partitions
  67. $partinfo"
  68.             else
  69.                 partitions="$partinfo"
  70.             fi
  71.         done
  72.         close_dialog
  73.  
  74.         IFS="$NL"
  75.         for partinfo in $partitions; do
  76.             restore_ifs
  77.             for u in /lib/partman/update.d/*; do
  78.                 [ -x "$u" ] || continue
  79.                 $u $dev $partinfo
  80.             done
  81.             IFS="$NL"
  82.         done
  83.         restore_ifs
  84.     done
  85.  
  86.     if ! confirm_changes "partman"; then
  87.         trap - EXIT
  88.         exit 10
  89.     fi
  90. fi
  91.  
  92. if [ -z "$PARTMAN_ALREADY_CHECKED" ]; then
  93.     for s in /lib/partman/check.d/*; do
  94.         if [ -x $s ]; then
  95.             $s
  96.         fi
  97.     done
  98. fi
  99.  
  100. for s in /lib/partman/commit.d/*; do
  101.     if [ -x $s ]; then
  102.         $s
  103.     fi
  104. done
  105.  
  106. for s in /lib/partman/finish.d/*; do
  107.     if [ -x $s ]; then
  108.         $s
  109.     fi
  110. done
  111.